{%include file="../public/top.html"%}

<div id="content-header">
    <h1>素材管理</h1>
</div>
<div id="breadcrumb">
    <a href="#" title="Go to Home" class="tip-bottom"><i class="icon-home"></i> 素材管理</a>
    <a href="#" class="current">修改素材</a>
</div>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
            <div class="widget-box">
                <div class="widget-title">
								<span class="icon">
									<i class="icon-th"></i>
								</span>
                    <h5>修改素材</h5>
                </div>
                <div class="widget-content nopadding">
                    <form action="/matter_manage/do_update_matter" method="post" class="form-horizontal" enctype="multipart/form-data" />
                        <div class="control-group">
                            <label class="control-label">字</label>
                            <div class="controls input-small">
                                <input type="text" name="field_name" value="{%$info.field_name%}" />
                            </div>
                        </div>
                        
                        <div class="control-group">
                            <label class="control-label">书写人</label>
                            <div class="controls">
                                <select name="w_id">
                                    {%foreach from=$write_person_datas item=person%}
                                        <option value="{%$person.id%}" {%if $info.w_id eq $person.id%}selected{%/if%}>{%$person.name%}</option>
                                    {%/foreach%}
                                </select>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">字体图</label>
                            <div class="controls">
                                <input name="img_path" type="file" />
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">描述</label>
                            <div class="controls">
                                <script id="container" name="description" style="width:750px;height:240px;" type="text/plain">{%$info.description%}</script>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">字体GIF图</label>
                            <div class="controls">
                                <input name="gif_path" type="file" />
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">坐标</label>
                            <div class="controls input-medium">
                                {%foreach from=$info.coord item=coord%}
                                <textarea name="coord[]" placeholder="x,y坐标用,分割,内容使用:">{%$coord%}</textarea>
                                {%/foreach%}
                                <button type="button" class="btn btn-info btn-mini clone_btn">添加坐标点</button>
                            </div>
                        </div>
                        <div class="form-actions">
                            <input type="hidden" name="id" value="{%$info.id%}">
                            <button type="submit" class="btn btn-primary">Save</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    {%include file="../public/bottom.html"%}
    <script type="text/javascript" src="/static/js/ueditor.config.js"></script>
    <!-- 编辑器源码文件 -->
    <script type="text/javascript" src="/static/js/ueditor.all.min.js"></script>
    <script type="text/javascript" src="/static/js/lang/zh-cn/zh-cn.js"></script>
    <!-- 实例化编辑器 -->
    <script type="text/javascript">
        var ue = UE.getEditor('container');
    </script>
    <script>
        $(".clone_btn").click(function(){
            var clone_htm = "<textarea name='coord[]'></textarea><button class='btn btn-info btn-mini del_btn' type='button'>删除坐标点</button>";
            $(this).after(clone_htm);
            // $(this).append($(this).prev('input').clone(true));
        });
        $(document).on('click','.del_btn',function(){
            $(this).prev('textarea').remove();
            $(this).remove();
        });
    </script>

